package com.cxf.cxfcommons.redis;

import org.redisson.Redisson;
import org.redisson.api.RBlockingDeque;
import org.redisson.api.RMap;
import org.redisson.client.codec.Codec;
import org.redisson.client.codec.StringCodec;
import org.redisson.config.Config;

import java.util.HashSet;
import java.util.Set;

/**
 * description: RedissonUtils <br>
 * date: 2021/12/2 19:47 <br>
 * author: cxf <br>
 * version: 1.0 <br>
 */
public class RedissonUtils {

    public static void main(String[] args) {

        Config config = new Config();
        config.useSingleServer().setPassword("cxfredis").setAddress("redis://106.13.224.166:6379");

        Redisson redisson = (Redisson) Redisson.create(config);

        RMap<Object, Object> map = redisson.getMap("cxf:newday", new StringCodec("utf-8"));
        final Object put = map.put("hicxf", "cxf");
        boolean b = map.fastPut("hi", "fastput");

        System.out.println("");


        RBlockingDeque<Object> cxdblockqueue = redisson.getBlockingDeque("cxdblockqueue", new StringCodec("utf-8"));
        boolean blockqueuecxf = cxdblockqueue.add("blockqueuecxf");

        System.out.println(blockqueuecxf);
        System.out.println(cxdblockqueue.poll());

        Set<Object> set = new HashSet<>();


    }
}
